Skip to main content

utils

utils.toTokenAmount(amount: string, decimals: number)

const isValid = utils.toTokenAmount('100000000', 8)
// 1

utils.isValidAddress(address: string)

const isValid = utils.isValidAddress('qzysdapqk4q3442fx59y2ajnsbx5maz3d6japb7jngjrqq5xqddh60n420', 0)
// true

utils.extractPublicKey(address: string)

const shardIndex = utils.extractPublicKey('qzysdapqk4q3442fx59y2ajnsbx5maz3d6japb7jngjrqq5xqddh60n420', 0)
// Unit8Array

utils.addressToShard(address: string, shardOrder?: number)

const shardIndex = utils.addressToShard('qzysdapqk4q3442fx59y2ajnsbx5maz3d6japb7jngjrqq5xqddh60n420', 0)
// 0